package com.nageoffer.shortlink.project.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nageoffer.shortlink.project.dao.entity.LinkStatsTodayDO;
import org.apache.ibatis.annotations.Insert;

public interface LinkStatsTodayMapper extends BaseMapper<LinkStatsTodayDO> {

    @Insert("""
            insert into t_link_stats_today(full_short_url, date, today_pv,today_uv,today_uip,
                create_time, update_time, del_flag)
                VALUES (#{fullShortUrl},#{date},#{todayPv},#{todayUv},#{todayUip},now(),now(),0)
                on DUPLICATE KEY UPDATE today_pv=today_pv+#{todayPv},today_uv=today_uv+#{todayUv},today_uip=today_uip+#{todayUip},update_time=now();
            """)
    void shortLinkTodayStats(LinkStatsTodayDO linkStatsTodayDO);


}
